package com.boco.blch.analysiser.compliance.HW.data;





import com.boco.blch.analysiser.compliance.ComplianceResolved;

/**
 * @author 黄戈
 * MPPDB 接口公开安全基线要求项 
 *
 */
public class BOCO_mpp_SecurityAbilityGuarantee_PublicInterface implements ComplianceResolved{
	
	private final static String GbaseStart="gbase-start";
	private final static String GbaseEnd="gbase-end";

	
	@Override
	public int realEchoResolved(String echoResult) {
		
		
		int gbaseFlag=SUCCESS;
		
		if(!echoResult.equals("")&&echoResult!= null&&(!echoResult.contains(NoPermission1)&&!echoResult.contains(NoPermission2)&&!echoResult.contains(NoPermission3))){
		//进程gbase的进程号及端口获取
		
		String gbaseResult=echoResult.substring(echoResult.indexOf(GbaseStart)+GbaseStart.length(),echoResult.indexOf(GbaseEnd)).trim();
		if(gbaseResult.length()>0&&gbaseResult!=null){
		String[] gbaseResults = gbaseResult.split("\n"); 
		for (int i=0;i<gbaseResults.length;i++){
			//System.out.println(gbaseResults[0]);
			if (gbaseResults[i].contains(":")&&!gbaseResults[i].contains(":5050")){
				gbaseFlag=FAILED;
				break;
			}else{
				gbaseFlag=SUCCESS;
			}
			
		}
		return gbaseFlag;
		}else{
			return UNKNOWN;
		}
		}else {
			return FAILED;
		}
		
	}
	
	/*
*/
	

}
